home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / qualitas / bc2 / libsrc / dpmi.asm < prev    next >
Assembly Source File  |  1992-04-09  |  70KB  |  2,206 lines

  1. { draw image }
  2.      Delay(PauseTime);
  3. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  4.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  5.   until KeyPressed;
  6.   FreeMem(Saucer, size);
  7.   WaitToGo;
  8. end; { PutImagePlay }
  9.  
  10. procedure PolyPlay;
  11. { Draw random polygons with random fill styles on the screen }
  12. const
  13.   MaxPts = 5;
  14. type
  15.   PolygonType = array[1..MaxPts] of PointType;
  16. var
  17.   Poly : PolygonType;
  18.   I, Color : word;
  19. begin
  20.   MainWindow('FillPoly demonstration');
  21.   StatusLine('Esc aborts or press a key...');
  22.   repeat
  23.     Color := RandColor;
  24.     SetFillStyle(Random(11)+1, Color);
  25.     SetColor(Color);
  26.     for I := 1 to MaxPts do
  27.       with Poly[I] do
  28.       begin
  29.         X := Random(MaxX);
  30.         Y := Random(MaxY);
  31.       end;
  32.     FillPoly(MaxPts, Poly);
  33.   until KeyPressed;
  34.   WaitToGo;
  35. end; { PolyPlay }
  36.  
  37. procedure FillStylePlay;
  38. { Display all of the predefined fill styles available }
  39. var
  40.   Style    : word;
  41.   Width    : word;
  42.   Height   : word;
  43.   X, Y     : word;
  44.   I, J     : word;
  45.   ViewInfo : ViewPortType;
  46.  
  47. procedure DrawBox(X, Y : word);
  48. begin
  49.   SetFillStyle(Style, MaxColor);
  50.   with ViewInfo do
  51.     Bar(X, Y, X+Width, Y+Height);
  52.   Rectangle(X, Y, X+Width, Y+Height);
  53.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  54.   Inc(Style);
  55. end; { DrawBox }
  56.  
  57. begin
  58.   MainWindow('Pre-defined fill styles');
  59.   GetViewSettings(ViewInfo);
  60.   with ViewInfo do
  61.   begin
  62.     Width := 2 * ((x2+1) div 13);
  63.     Height := 2 * ((y2-10) div 10);
  64.   end;
  65.   X := Width div 2;
  66.   Y := Height div 2;
  67.   Style := 0;
  68.   for J := 1 to 3 do
  69.   begin
  70.     for I := 1 to 4 do
  71.     begin
  72.       DrawBox(X, Y);
  73.       Inc(X, (Width div 2) * 3);
  74.     end;
  75.     X := Width div 2;
  76.     Inc(Y, (Height div 2) * 3);
  77.   end;
  78.   SetTextJustify(LeftText, TopText);
  79.   WaitToGo;
  80. end; { FillStylePlay }
  81.  
  82. procedure FillPatternPlay;
  83. { Display some user defined fill patterns }
  84. const
  85.   Patterns : array[0..11] of FillPatternType = (
  86.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  87.             OldColor which has a path of pixels of OldColor or NewColor
  88.             with sides touching back to the seed point, (XSeed, YSeed).
  89.             Therefore, only pixels of OldColor are modified and no other
  90.             information is changed.
  91.  
  92.             SEE ALSO
  93.  
  94.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  95.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  96.             SETVIEW
  97.  
  98.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  99.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  100.             IF WHICHVGA = 0 THEN STOP
  101.             DUMMY=RES640
  102.             SETVIEW 100, 100, 539, 379
  103.             FILLVIEW 10
  104.             WHILE INKEY$ = ""
  105.             WEND
  106.             VIDEOMODESET VMODE
  107.             END
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.                                                                          63
  125.  
  126.  
  127.  
  128.  
  129.  
  130.           FONTGETINFO
  131.  
  132.             PROTOTYPE
  133.  
  134.             SUB FONTGETINFO (Width%, Height%)
  135.  
  136.             INPUT
  137.  
  138.             no input parameters
  139.     WEND
  140.             MOUSEEXIT
  141.             VIDEOMODESET VMODE
  142.             END
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.                                                                          86
  184.  
  185.  
  186.  
  187.  
  188.  
  189.           MOUSECURSORDEFAULT
  190.  
  191.             PROTOTYPE
  192.  
  193.             SUB MOUSECURSORDEFAULT ()
  194.  
  195.             INPUT
  196.  
  197.             no input parameters
  198.  
  199.             OUTPUT
  200.  
  201.             no value returned
  202.  
  203.             USAGE
  204.  
  205.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  206.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  207. ⁿ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  208. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  209. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  210. $╤
  211. #@Ñú4,p&e÷ü¼_ÇQºÑ4òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±░┤ÖÇD└D0Å╡`   $ «îO@╧1
  212. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  213. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩░£▒Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  214.       end;
  215.     end;
  216.   end;
  217.   WaitToGo;
  218. end; { UserLineStylePlay }
  219.  
  220.  
  221. procedure SayGoodbye;
  222. { Say goodbye and then exit the program }
  223. var
  224.   ViewInfo : ViewPortType;
  225. begin
  226.   MainWindow('');
  227.   GetViewSettings(ViewInfo);
  228.   SetTextStyle(TriplexFont, HorizDir, 4);
  229.   SetTextJustify(CenterText, CenterText);
  230.   with ViewInfo do
  231.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  232.   StatusLine('Press any key to quit...');
  233.   repeat until KeyPressed;
  234. end; { SayGoodbye }
  235.  
  236.  
  237. PROCEDURE SelectMode;
  238. VAR
  239.     choice1,choice2     : CHAR;
  240.    xsize,ysize            : WORD;
  241. BEGIN
  242.     (* Let's select a mode *)
  243.     ClrScr;
  244.     WriteLn('VESADEMO:');
  245.     WriteLn('1. 256 colors');
  246.     WriteLn('2. 32768 colors');
  247.     WriteLn('3. 65536 colors');
  248.     WriteLn('4. 16777216 colors');
  249.     WriteLn('Q uit');
  250.     WriteLn;
  251.     Write('Your choice: ');
  252.     REPEAT
  253.         ReadLn(choice1);
  254.       IF choice1 <> '1' THEN BEGIN
  255.           WriteLn('Sorry !');
  256.          WriteLn('This demo wasn''t written for more as 256 colors !');
  257.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  258.          WriteLn('Switching to 256 colors.');
  259.          choice1 := '1';
  260.       END;
  261.     UNTIL choice1 IN ['1'..'4','q'];
  262.     IF choice1 = 'q' THEN Halt;
  263.  
  264.     WriteLn;
  265.     WriteLn;
  266.     WriteLn('a. 320x200');
  267.     WriteLn('b. 640x480');
  268.     WriteLn('c. 800x600');
  269.     WriteLn('d. 1024x768');
  270.     WriteLn('e. 1280x1024');
  271.     WriteLn('Q uit');
  272.     WriteLn;
  273.     Write('Your choice: ');
  274.     REPEAT
  275.         ReadLn(choice2);
  276.     UNTIL choice2 IN ['a'..'e','q'];
  277.     IF choice2 = 'q' THEN Halt;
  278.  
  279.     CASE choice2 OF
  280.         'a' : BEGIN
  281.             xsize := 320;
  282.             ysize := 200;
  283.         END;
  284.         'b' : BEGIN
  285.             xsize := 640;
  286.             ysize := 480;
  287.         END;
  288.         'c' : BEGIN
  289.             xsize := 800;
  290.             ysize := 600;
  291.         END;
  292.         'd' : BEGIN
  293.             xsize := 1024;
  294.             ysize := 768;
  295.         END;
  296.         'e' : BEGIN
  297.             xsize := 1280;
  298.             ysize := 1024;
  299.         END;
  300.     END;
  301.     CASE choice1 OF
  302.         '1' : mode := FindVesaMode(xsize,ysize,8);
  303.         '2' : mode := FindVesaMode(xsize,ysize,15);
  304.         '3' : mode := FindVesaMode(xsize,ysize,16);
  305.         '4' : mode := FindVesaMode(xsize,ysize,24);
  306.     END;
  307.     IF mode = 0 THEN BEGIN
  308.         WriteLn('No such mode could be found !');
  309.         WriteLn('Switching to to 320x200.');
  310.         ReadKey;
  311.         mode := V320x200x256;
  312.     END;
  313. END;
  314.  
  315. begin { program body }
  316.   SelectMode;
  317.   Initialize;
  318.   ReportStatus;
  319.  
  320. {  AspectRatioPlay; }
  321.   FillEllipsePlay;
  322.   SectorPlay;
  323.   WriteModePlay;
  324.  
  325.   ColorPlay;
  326.   { PalettePlay only intended to work on these drivers: }
  327.   if (GraphDriver = EGA) or
  328.       (GraphDriver = EGA64) or
  329.       (GraphDriver = VGA) then
  330.      PalettePlay;
  331.   PutPixelPlay;
  332. {  PutImagePlay; }
  333.   RandBarPlay;
  334.   BarPlay;
  335.   Bar3DPlay;
  336.   ArcPlay;
  337.   CirclePlay;
  338.   PiePlay;
  339.   LineToPlay;
  340.   LineRelPlay;
  341. {  LineStylePlay; }
  342. {  UserLineStylePlay; }
  343.   TextDump;
  344.   TextPlay;
  345.   CrtModePlay;
  346.   FillStylePlay;
  347.   FillPatternPlay;
  348.   PolyPlay;
  349.   SayGoodbye;
  350. {  CloseGraph; }
  351.   CloseVesa;
  352. end.
  353. ***************************************************
  354.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  355.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  356. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  357. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  358.     Color := RandColor;
  359.     SetColor(Color);
  360.     SetFillStyle(Random(CloseDotFill)+1, Color);
  361.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  362.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  363.   until KeyPressed;
  364.   WaitToGo;
  365. end; { RandBarPlay }
  366.  
  367. procedure ArcPlay;
  368. { Draw random arcs on the screen }
  369. var
  370.   MaxRadius : word;
  371.   EndAngle : word;
  372.   ArcInfo : ArcCoordsType;
  373. begin
  374.   MainWindow('Arc / GetArcCoords demonstration');
  375.   StatusLine('Esc aborts or press a key');
  376.   MaxRadius := MaxY div 10;
  377.   repeat
  378.     SetColor(RandColor);
  379.     EndAngle := Random(360);
  380.     SetLineStyle(SolidLn, 0, NormWidth);
  381.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  382.     GetArcCoords(ArcInfo);
  383.     with ArcInfo do
  384.     begin
  385.       Line(X, Y, XStart, YStart);
  386.       Line(X, Y, Xend, Yend);
  387.     end;
  388.   until KeyPressed;
  389.   WaitToGo;
  390. end; { ArcPlay }
  391.  
  392. procedure PutPixelPlay;
  393. { Demonstrate the PutPixel and GetPixel commands }
  394. const
  395.   Seed   = 1962; { A seed for the random number generator }
  396.   NumPts = 2000; { The number of pixels plotted }
  397.   Esc    = #27;
  398. var
  399.   I : word;
  400.   X, Y, Color : word;
  401.   XMax, YMax  : integer;
  402.   ViewInfo    : ViewPortType;
  403. begin
  404.   MainWindow('PutPixel / GetPixel demonstration');
  405.   StatusLine('Esc aborts or press a key...');
  406.  
  407.   GetViewSettings(ViewInfo);
  408.   with ViewInfo do
  409.   begin
  410.     XMax := (x2-x1-1);
  411.     YMax := (y2-y1-1);
  412.   end;
  413.  
  414.   while not KeyPressed do
  415.   begin
  416.     { Plot random pixels }
  417.     RandSeed := Seed;
  418.     I := 0;
  419.     while (not KeyPressed) and (I < NumPts) do
  420.     begin
  421.       Inc(I);
  422.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  423.     end;
  424.  
  425.     { Erase pixels }
  426.     RandSeed := Seed;
  427.     I := 0;
  428.     while (not KeyPressed) and (I < NumPts) do
  429.     begin
  430.       Inc(I);
  431.       X := Random(XMax)+1;
  432.       Y := Random(YMax)+1;
  433.       Color := GetPixel(X, Y);
  434.         if Color = RandColor then
  435.           PutPixel(X, Y, 0);
  436.      end;
  437.   end;
  438.   WaitToGo;
  439. end; { PutPixelPlay }
  440.  
  441. procedure PutImagePlay;
  442. { Demonstrate the GetImage and PutImage commands }
  443.  
  444. const
  445.   r  = 20;
  446.   StartX = 100;
  447.   StartY = 50;
  448.  
  449. var
  450.   CurPort : ViewPortType;
  451.  
  452. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  453. var
  454.   Step : integer;
  455. begin
  456.   Step := Random(2*r);
  457.   if Odd(Step) then
  458.     Step := -Step;
  459.   X := X + Step;
  460.   Step := Random(r);
  461.   if Odd(Step) then
  462.     Step := -Step;
  463.   Y := Y + Step;
  464.  
  465.   { Make saucer bounce off viewport walls }
  466.   with CurPort do
  467.   begin
  468.     if (x1 + X + Width - 1 > x2) then
  469.       X := x2-x1 - Width + 1
  470.     else
  471.       if (X < 0) then
  472.         X := 0;
  473.     if (y1 + Y + Height - 1 > y2) then
  474.       Y := y2-y1 - Height + 1
  475.     else
  476.       if (Y < 0) then
  477.         Y := 0;
  478.   end;
  479. end; { MoveSaucer }
  480.  
  481. var
  482.   Pausetime : word;
  483.   Saucer    : pointer;
  484.   X, Y      : integer;
  485.   ulx, uly  : word;
  486.   lrx, lry  : word;
  487.   Size      : word;
  488.   I         : word;
  489. begin
  490.   ClearDevice;
  491.   FullPort;
  492.  
  493.   { PaintScreen }
  494.   ClearDevice;
  495.   MainWindow('GetImage / PutImage Demonstration');
  496.   StatusLine('Esc aborts or press a key...');
  497.   GetViewSettings(CurPort);
  498.  
  499.   { DrawSaucer }
  500.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  501.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  502.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  503.   Circle(StartX+10, StartY-12, 2);
  504.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  505.   Circle(StartX-10, StartY-12, 2);
  506.   SetFillStyle(SolidFill, MaxColor);
  507.   FloodFill(StartX+1, StartY+4, GetColor);
  508.  
  509.   { ReadSaucerImage }
  510.   ulx := StartX-(r+1);
  511.   uly := StartY-14;
  512.   lrx := StartX+(r+1);
  513.   lry := StartY+(r div 3)+3;
  514.  
  515.   Size := ImageSize(ulx, uly, lrx, lry);
  516.   GetMem(Saucer, Size);
  517.   GetImage(ulx, uly, lrx, lry, Saucer^);
  518. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  519.  
  520.   { Plot some "stars" }
  521.   for I := 1 to 1000 do
  522.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  523.   X := MaxX div 2;
  524.   Y := MaxY div 2;
  525.   PauseTime := 70;
  526.  
  527.   { Move the saucer around }
  528.   repeat
  529. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  530.      Delay(PauseTime);
  531. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  532.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  533.   until KeyPressed;
  534.   FreeMem(Saucer, size);
  535.   WaitToGo;
  536. end; { PutImagePlay }
  537.  
  538. procedure PolyPlay;
  539. { Draw random polygons with random fill styles on the screen }
  540. const
  541.   MaxPts = 5;
  542. type
  543.   PolygonType = array[1..MaxPts] of PointType;
  544. var
  545.   Poly : PolygonType;
  546.   I, Color : word;
  547. begin
  548.   MainWindow('FillPoly demonstration');
  549.   StatusLine('Esc aborts or press a key...');
  550.   repeat
  551.     Color := RandColor;
  552.     SetFillStyle(Random(11)+1, Color);
  553.     SetColor(Color);
  554.     for I := 1 to MaxPts do
  555.       with Poly[I] do
  556.       begin
  557.         X := Random(MaxX);
  558.         Y := Random(MaxY);
  559.       end;
  560.     FillPoly(MaxPts, Poly);
  561.   until KeyPressed;
  562.   WaitToGo;
  563. end; { PolyPlay }
  564.  
  565. procedure FillStylePlay;
  566. { Display all of the predefined fill styles available }
  567. var
  568.   Style    : word;
  569.   Width    : word;
  570.   Height   : word;
  571.   X, Y     : word;
  572.   I, J     : word;
  573.   ViewInfo : ViewPortType;
  574.  
  575. procedure DrawBox(X, Y : word);
  576. begin
  577.   SetFillStyle(Style, MaxColor);
  578.   with ViewInfo do
  579.     Bar(X, Y, X+Width, Y+Height);
  580.   Rectangle(X, Y, X+Width, Y+Height);
  581.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  582.   Inc(Style);
  583. end; { DrawBox }
  584.  
  585. begin
  586.   MainWindow('Pre-defined fill styles');
  587.   GetViewSettings(ViewInfo);
  588.   with ViewInfo do
  589.   begin
  590.     Width := 2 * ((x2+1) div 13);
  591.     Height := 2 * ((y2-10) div 10);
  592.   end;
  593.   X := Width div 2;
  594.   Y := Height div 2;
  595.   Style := 0;
  596.   for J := 1 to 3 do
  597.   begin
  598.     for I := 1 to 4 do
  599.     begin
  600.       DrawBox(X, Y);
  601.       Inc(X, (Width div 2) * 3);
  602.     end;
  603.     X := Width div 2;
  604.     Inc(Y, (Height div 2) * 3);
  605.   end;
  606.   SetTextJustify(LeftText, TopText);
  607.   WaitToGo;
  608. end; { FillStylePlay }
  609.  
  610. procedure FillPatternPlay;
  611. { Display some user defined fill patterns }
  612. const
  613.   Patterns : array[0..11] of FillPatternType = (
  614.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  615.             OldColor which has a path of pixels of OldColor or NewColor
  616.             with sides touching back to the seed point, (XSeed, YSeed).
  617.             Therefore, only pixels of OldColor are modified and no other
  618.             information is changed.
  619.  
  620.             SEE ALSO
  621.  
  622.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  623.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  624.             SETVIEW
  625.  
  626.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  627.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  628.             IF WHICHVGA = 0 THEN STOP
  629.             DUMMY=RES640
  630.             SETVIEW 100, 100, 539, 379
  631.             FILLVIEW 10
  632.             WHILE INKEY$ = ""
  633.             WEND
  634.             VIDEOMODESET VMODE
  635.             END
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.                                                                          63
  653.  
  654.  
  655.  
  656.  
  657.  
  658.           FONTGETINFO
  659.  
  660.             PROTOTYPE
  661.  
  662.             SUB FONTGETINFO (Width%, Height%)
  663.  
  664.             INPUT
  665.  
  666.             no input parameters
  667.     WEND
  668.             MOUSEEXIT
  669.             VIDEOMODESET VMODE
  670.             END
  671.  
  672.  
  673.  
  674.  
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.                                                                          86
  712.  
  713.  
  714.  
  715.  
  716.  
  717.           MOUSECURSORDEFAULT
  718.  
  719.             PROTOTYPE
  720.  
  721.             SUB MOUSECURSORDEFAULT ()
  722.  
  723.             INPUT
  724.  
  725.             no input parameters
  726.  
  727.             OUTPUT
  728.  
  729.             no value returned
  730.  
  731.             USAGE
  732.  
  733.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  734.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  735. ⁿ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  736. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  737. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  738. $╤
  739. #@Ñú4,p&e÷ü¼_ÇQºÑ4òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±░┤ÖÇD└D0Å╡`   $ «îO@╧1
  740. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  741. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩░£▒Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  742.       end;
  743.     end;
  744.   end;
  745.   WaitToGo;
  746. end; { UserLineStylePlay }
  747.  
  748.  
  749. procedure SayGoodbye;
  750. { Say goodbye and then exit the program }
  751. var
  752.   ViewInfo : ViewPortType;
  753. begin
  754.   MainWindow('');
  755.   GetViewSettings(ViewInfo);
  756.   SetTextStyle(TriplexFont, HorizDir, 4);
  757.   SetTextJustify(CenterText, CenterText);
  758.   with ViewInfo do
  759.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  760.   StatusLine('Press any key to quit...');
  761.   repeat until KeyPressed;
  762. end; { SayGoodbye }
  763.  
  764.  
  765. PROCEDURE SelectMode;
  766. VAR
  767.     choice1,choice2     : CHAR;
  768.    xsize,ysize            : WORD;
  769. BEGIN
  770.     (* Let's select a mode *)
  771.     ClrScr;
  772.     WriteLn('VESADEMO:');
  773.     WriteLn('1. 256 colors');
  774.     WriteLn('2. 32768 colors');
  775.     WriteLn('3. 65536 colors');
  776.     WriteLn('4. 16777216 colors');
  777.     WriteLn('Q uit');
  778.     WriteLn;
  779.     Write('Your choice: ');
  780.     REPEAT
  781.         ReadLn(choice1);
  782.       IF choice1 <> '1' THEN BEGIN
  783.           WriteLn('Sorry !');
  784.          WriteLn('This demo wasn''t written for more as 256 colors !');
  785.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  786.          WriteLn('Switching to 256 colors.');
  787.          choice1 := '1';
  788.       END;
  789.     UNTIL choice1 IN ['1'..'4','q'];
  790.     IF choice1 = 'q' THEN Halt;
  791.  
  792.     WriteLn;
  793.     WriteLn;
  794.     WriteLn('a. 320x200');
  795.     WriteLn('b. 640x480');
  796.     WriteLn('c. 800x600');
  797.     WriteLn('d. 1024x768');
  798.     WriteLn('e. 1280x1024');
  799.     WriteLn('Q uit');
  800.     WriteLn;
  801.     Write('Your choice: ');
  802.     REPEAT
  803.         ReadLn(choice2);
  804.     UNTIL choice2 IN ['a'..'e','q'];
  805.     IF choice2 = 'q' THEN Halt;
  806.  
  807.     CASE choice2 OF
  808.         'a' : BEGIN
  809.             xsize := 320;
  810.             ysize := 200;
  811.         END;
  812.         'b' : BEGIN
  813.             xsize := 640;
  814.             ysize := 480;
  815.         END;
  816.         'c' : BEGIN
  817.             xsize := 800;
  818.             ysize := 600;
  819.         END;
  820.         'd' : BEGIN
  821.             xsize := 1024;
  822.             ysize := 768;
  823.         END;
  824.         'e' : BEGIN
  825.             xsize := 1280;
  826.             ysize := 1024;
  827.         END;
  828.     END;
  829.     CASE choice1 OF
  830.         '1' : mode := FindVesaMode(xsize,ysize,8);
  831.         '2' : mode := FindVesaMode(xsize,ysize,15);
  832.         '3' : mode := FindVesaMode(xsize,ysize,16);
  833.         '4' : mode := FindVesaMode(xsize,ysize,24);
  834.     END;
  835.     IF mode = 0 THEN BEGIN
  836.         WriteLn('No such mode could be found !');
  837.         WriteLn('Switching to to 320x200.');
  838.         ReadKey;
  839.         mode := V320x200x256;
  840.     END;
  841. END;
  842.  
  843. begin { program body }
  844.   SelectMode;
  845.   Initialize;
  846.   ReportStatus;
  847.  
  848. {  AspectRatioPlay; }
  849.   FillEllipsePlay;
  850.   SectorPlay;
  851.   WriteModePlay;
  852.  
  853.   ColorPlay;
  854.   { PalettePlay only intended to work on these drivers: }
  855.   if (GraphDriver = EGA) or
  856.       (GraphDriver = EGA64) or
  857.       (GraphDriver = VGA) then
  858.      PalettePlay;
  859.   PutPixelPlay;
  860. {  PutImagePlay; }
  861.   RandBarPlay;
  862.   BarPlay;
  863.   Bar3DPlay;
  864.   ArcPlay;
  865.   CirclePlay;
  866.   PiePlay;
  867.   LineToPlay;
  868.   LineRelPlay;
  869. {  LineStylePlay; }
  870. {  UserLineStylePlay; }
  871.   TextDump;
  872.   TextPlay;
  873.   CrtModePlay;
  874.   FillStylePlay;
  875.   FillPatternPlay;
  876.   PolyPlay;
  877.   SayGoodbye;
  878. {  CloseGraph; }
  879.   CloseVesa;
  880. end.
  881. ***************************************************
  882.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  883.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  884. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  885. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  886.     Color := RandColor;
  887.     SetColor(Color);
  888.     SetFillStyle(Random(CloseDotFill)+1, Color);
  889.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  890.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  891.   until KeyPressed;
  892.   WaitToGo;
  893. end; { RandBarPlay }
  894.  
  895. procedure ArcPlay;
  896. { Draw random arcs on the screen }
  897. var
  898.   MaxRadius : word;
  899.   EndAngle : word;
  900.   ArcInfo : ArcCoordsType;
  901. begin
  902.   MainWindow('Arc / GetArcCoords demonstration');
  903.   StatusLine('Esc aborts or press a key');
  904.   MaxRadius := MaxY div 10;
  905.   repeat
  906.     SetColor(RandColor);
  907.     EndAngle := Random(360);
  908.     SetLineStyle(SolidLn, 0, NormWidth);
  909.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  910.     GetArcCoords(ArcInfo);
  911.     with ArcInfo do
  912.     begin
  913.       Line(X, Y, XStart, YStart);
  914.       Line(X, Y, Xend, Yend);
  915.     end;
  916.   until KeyPressed;
  917.   WaitToGo;
  918. end; { ArcPlay }
  919.  
  920. procedure PutPixelPlay;
  921. { Demonstrate the PutPixel and GetPixel commands }
  922. const
  923.   Seed   = 1962; { A seed for the random number generator }
  924.   NumPts = 2000; { The number of pixels plotted }
  925.   Esc    = #27;
  926. var
  927.   I : word;
  928.   X, Y, Color : word;
  929.   XMax, YMax  : integer;
  930.   ViewInfo    : ViewPortType;
  931. begin
  932.   MainWindow('PutPixel / GetPixel demonstration');
  933.   StatusLine('Esc aborts or press a key...');
  934.  
  935.   GetViewSettings(ViewInfo);
  936.   with ViewInfo do
  937.   begin
  938.     XMax := (x2-x1-1);
  939.     YMax := (y2-y1-1);
  940.   end;
  941.  
  942.   while not KeyPressed do
  943.   begin
  944.     { Plot random pixels }
  945.     RandSeed := Seed;
  946.     I := 0;
  947.     while (not KeyPressed) and (I < NumPts) do
  948.     begin
  949.       Inc(I);
  950.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  951.     end;
  952.  
  953.     { Erase pixels }
  954.     RandSeed := Seed;
  955.     I := 0;
  956.     while (not KeyPressed) and (I < NumPts) do
  957.     begin
  958.       Inc(I);
  959.       X := Random(XMax)+1;
  960.       Y := Random(YMax)+1;
  961.       Color := GetPixel(X, Y);
  962.         if Color = RandColor then
  963.           PutPixel(X, Y, 0);
  964.      end;
  965.   end;
  966.   WaitToGo;
  967. end; { PutPixelPlay }
  968.  
  969. procedure PutImagePlay;
  970. { Demonstrate the GetImage and PutImage commands }
  971.  
  972. const
  973.   r  = 20;
  974.   StartX = 100;
  975.   StartY = 50;
  976.  
  977. var
  978.   CurPort : ViewPortType;
  979.  
  980. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  981. var
  982.   Step : integer;
  983. begin
  984.   Step := Random(2*r);
  985.   if Odd(Step) then
  986.     Step := -Step;
  987.   X := X + Step;
  988.   Step := Random(r);
  989.   if Odd(Step) then
  990.     Step := -Step;
  991.   Y := Y + Step;
  992.  
  993.   { Make saucer bounce off viewport walls }
  994.   with CurPort do
  995.   begin
  996.     if (x1 + X + Width - 1 > x2) then
  997.       X := x2-x1 - Width + 1
  998.     else
  999.       if (X < 0) then
  1000.         X := 0;
  1001.     if (y1 + Y + Height - 1 > y2) then
  1002.       Y := y2-y1 - Height + 1
  1003.     else
  1004.       if (Y < 0) then
  1005.         Y := 0;
  1006.   end;
  1007. end; { MoveSaucer }
  1008.  
  1009. var
  1010.   Pausetime : word;
  1011.   Saucer    : pointer;
  1012.   X, Y      : integer;
  1013.   ulx, uly  : word;
  1014.   lrx, lry  : word;
  1015.   Size      : word;
  1016.   I         : word;
  1017. begin
  1018.   ClearDevice;
  1019.   FullPort;
  1020.  
  1021.   { PaintScreen }
  1022.   ClearDevice;
  1023.   MainWindow('GetImage / PutImage Demonstration');
  1024.   StatusLine('Esc aborts or press a key...');
  1025.   GetViewSettings(CurPort);
  1026.  
  1027.   { DrawSaucer }
  1028.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1029.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1030.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1031.   Circle(StartX+10, StartY-12, 2);
  1032.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1033.   Circle(StartX-10, StartY-12, 2);
  1034.   SetFillStyle(SolidFill, MaxColor);
  1035.   FloodFill(StartX+1, StartY+4, GetColor);
  1036.  
  1037.   { ReadSaucerImage }
  1038.   ulx := StartX-(r+1);
  1039.   uly := StartY-14;
  1040.   lrx := StartX+(r+1);
  1041.   lry := StartY+(r div 3)+3;
  1042.  
  1043.   Size := ImageSize(ulx, uly, lrx, lry);
  1044.   GetMem(Saucer, Size);
  1045.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1046. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1047.  
  1048.   { Plot some "stars" }
  1049.   for I := 1 to 1000 do
  1050.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1051.   X := MaxX div 2;
  1052.   Y := MaxY div 2;
  1053.   PauseTime := 70;
  1054.  
  1055.   { Move the saucer around }
  1056.   repeat
  1057. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1058.      Delay(PauseTime);
  1059. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1060.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1061.   until KeyPressed;
  1062.   FreeMem(Saucer, size);
  1063.   WaitToGo;
  1064. end; { PutImagePlay }
  1065.  
  1066. procedure PolyPlay;
  1067. { Draw random polygons with random fill styles on the screen }
  1068. const
  1069.   MaxPts = 5;
  1070. type
  1071.   PolygonType = array[1..MaxPts] of PointType;
  1072. var
  1073.   Poly : PolygonType;
  1074.   I, Color : word;
  1075. begin
  1076.   MainWindow('FillPoly demonstration');
  1077.   StatusLine('Esc aborts or press a key...');
  1078.   repeat
  1079.     Color := RandColor;
  1080.     SetFillStyle(Random(11)+1, Color);
  1081.     SetColor(Color);
  1082.     for I := 1 to MaxPts do
  1083.       with Poly[I] do
  1084.       begin
  1085.         X := Random(MaxX);
  1086.         Y := Random(MaxY);
  1087.       end;
  1088.     FillPoly(MaxPts, Poly);
  1089.   until KeyPressed;
  1090.   WaitToGo;
  1091. end; { PolyPlay }
  1092.  
  1093. procedure FillStylePlay;
  1094. { Display all of the predefined fill styles available }
  1095. var
  1096.   Style    : word;
  1097.   Width    : word;
  1098.   Height   : word;
  1099.   X, Y     : word;
  1100.   I, J     : word;
  1101.   ViewInfo : ViewPortType;
  1102.  
  1103. procedure DrawBox(X, Y : word);
  1104. begin
  1105.   SetFillStyle(Style, MaxColor);
  1106.   with ViewInfo do
  1107.     Bar(X, Y, X+Width, Y+Height);
  1108.   Rectangle(X, Y, X+Width, Y+Height);
  1109.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1110.   Inc(Style);
  1111. end; { DrawBox }
  1112.  
  1113. begin
  1114.   MainWindow('Pre-defined fill styles');
  1115.   GetViewSettings(ViewInfo);
  1116.   with ViewInfo do
  1117.   begin
  1118.     Width := 2 * ((x2+1) div 13);
  1119.     Height := 2 * ((y2-10) div 10);
  1120.   end;
  1121.   X := Width div 2;
  1122.   Y := Height div 2;
  1123.   Style := 0;
  1124.   for J := 1 to 3 do
  1125.   begin
  1126.     for I := 1 to 4 do
  1127.     begin
  1128.       DrawBox(X, Y);
  1129.       Inc(X, (Width div 2) * 3);
  1130.     end;
  1131.     X := Width div 2;
  1132.     Inc(Y, (Height div 2) * 3);
  1133.   end;
  1134.   SetTextJustify(LeftText, TopText);
  1135.   WaitToGo;
  1136. end; { FillStylePlay }
  1137.  
  1138. procedure FillPatternPlay;
  1139. { Display some user defined fill patterns }
  1140. const
  1141.   Patterns : array[0..11] of FillPatternType = (
  1142.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1143.             OldColor which has a path of pixels of OldColor or NewColor
  1144.             with sides touching back to the seed point, (XSeed, YSeed).
  1145.             Therefore, only pixels of OldColor are modified and no other
  1146.             information is changed.
  1147.  
  1148.             SEE ALSO
  1149.  
  1150.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1151.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1152.             SETVIEW
  1153.  
  1154.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1155.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1156.             IF WHICHVGA = 0 THEN STOP
  1157.             DUMMY=RES640
  1158.             SETVIEW 100, 100, 539, 379
  1159.             FILLVIEW 10
  1160.             WHILE INKEY$ = ""
  1161.             WEND
  1162.             VIDEOMODESET VMODE
  1163.             END
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.                                                                          63
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.           FONTGETINFO
  1187.  
  1188.             PROTOTYPE
  1189.  
  1190.             SUB FONTGETINFO (Width%, Height%)
  1191.  
  1192.             INPUT
  1193.  
  1194.             no input parameters
  1195.     WEND
  1196.             MOUSEEXIT
  1197.             VIDEOMODESET VMODE
  1198.             END
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233.  
  1234.  
  1235.  
  1236.  
  1237.  
  1238.  
  1239.                                                                          86
  1240.  
  1241.  
  1242.  
  1243.  
  1244.  
  1245.           MOUSECURSORDEFAULT
  1246.  
  1247.             PROTOTYPE
  1248.  
  1249.             SUB MOUSECURSORDEFAULT ()
  1250.  
  1251.             INPUT
  1252.  
  1253.             no input parameters
  1254.  
  1255.             OUTPUT
  1256.  
  1257.             no value returned
  1258.  
  1259.             USAGE
  1260.  
  1261.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1262.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1263. ⁿ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1264. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1265. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1266. $╤
  1267. #@Ñú4,p&e÷ü¼_ÇQºÑ4òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1268. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1269. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩░£▒Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1270.       end;
  1271.     end;
  1272.   end;
  1273.   WaitToGo;
  1274. end; { UserLineStylePlay }
  1275.  
  1276.  
  1277. procedure SayGoodbye;
  1278. { Say goodbye and then exit the program }
  1279. var
  1280.   ViewInfo : ViewPortType;
  1281. begin
  1282.   MainWindow('');
  1283.   GetViewSettings(ViewInfo);
  1284.   SetTextStyle(TriplexFont, HorizDir, 4);
  1285.   SetTextJustify(CenterText, CenterText);
  1286.   with ViewInfo do
  1287.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1288.   StatusLine('Press any key to quit...');
  1289.   repeat until KeyPressed;
  1290. end; { SayGoodbye }
  1291.  
  1292.  
  1293. PROCEDURE SelectMode;
  1294. VAR
  1295.     choice1,choice2     : CHAR;
  1296.    xsize,ysize            : WORD;
  1297. BEGIN
  1298.     (* Let's select a mode *)
  1299.     ClrScr;
  1300.     WriteLn('VESADEMO:');
  1301.     WriteLn('1. 256 colors');
  1302.     WriteLn('2. 32768 colors');
  1303.     WriteLn('3. 65536 colors');
  1304.     WriteLn('4. 16777216 colors');
  1305.     WriteLn('Q uit');
  1306.     WriteLn;
  1307.     Write('Your choice: ');
  1308.     REPEAT
  1309.         ReadLn(choice1);
  1310.       IF choice1 <> '1' THEN BEGIN
  1311.           WriteLn('Sorry !');
  1312.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1313.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1314.          WriteLn('Switching to 256 colors.');
  1315.          choice1 := '1';
  1316.       END;
  1317.     UNTIL choice1 IN ['1'..'4','q'];
  1318.     IF choice1 = 'q' THEN Halt;
  1319.  
  1320.     WriteLn;
  1321.     WriteLn;
  1322.     WriteLn('a. 320x200');
  1323.     WriteLn('b. 640x480');
  1324.     WriteLn('c. 800x600');
  1325.     WriteLn('d. 1024x768');
  1326.     WriteLn('e. 1280x1024');
  1327.     WriteLn('Q uit');
  1328.     WriteLn;
  1329.     Write('Your choice: ');
  1330.     REPEAT
  1331.         ReadLn(choice2);
  1332.     UNTIL choice2 IN ['a'..'e','q'];
  1333.     IF choice2 = 'q' THEN Halt;
  1334.  
  1335.     CASE choice2 OF
  1336.         'a' : BEGIN
  1337.             xsize := 320;
  1338.             ysize := 200;
  1339.         END;
  1340.         'b' : BEGIN
  1341.             xsize := 640;
  1342.             ysize := 480;
  1343.         END;
  1344.         'c' : BEGIN
  1345.             xsize := 800;
  1346.             ysize := 600;
  1347.         END;
  1348.         'd' : BEGIN
  1349.             xsize := 1024;
  1350.             ysize := 768;
  1351.         END;
  1352.         'e' : BEGIN
  1353.             xsize := 1280;
  1354.             ysize := 1024;
  1355.         END;
  1356.     END;
  1357.     CASE choice1 OF
  1358.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1359.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1360.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1361.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1362.     END;
  1363.     IF mode = 0 THEN BEGIN
  1364.         WriteLn('No such mode could be found !');
  1365.         WriteLn('Switching to to 320x200.');
  1366.         ReadKey;
  1367.         mode := V320x200x256;
  1368.     END;
  1369. END;
  1370.  
  1371. begin { program body }
  1372.   SelectMode;
  1373.   Initialize;
  1374.   ReportStatus;
  1375.  
  1376. {  AspectRatioPlay; }
  1377.   FillEllipsePlay;
  1378.   SectorPlay;
  1379.   WriteModePlay;
  1380.  
  1381.   ColorPlay;
  1382.   { PalettePlay only intended to work on these drivers: }
  1383.   if (GraphDriver = EGA) or
  1384.       (GraphDriver = EGA64) or
  1385.       (GraphDriver = VGA) then
  1386.      PalettePlay;
  1387.   PutPixelPlay;
  1388. {  PutImagePlay; }
  1389.   RandBarPlay;
  1390.   BarPlay;
  1391.   Bar3DPlay;
  1392.   ArcPlay;
  1393.   CirclePlay;
  1394.   PiePlay;
  1395.   LineToPlay;
  1396.   LineRelPlay;
  1397. {  LineStylePlay; }
  1398. {  UserLineStylePlay; }
  1399.   TextDump;
  1400.   TextPlay;
  1401.   CrtModePlay;
  1402.   FillStylePlay;
  1403.   FillPatternPlay;
  1404.   PolyPlay;
  1405.   SayGoodbye;
  1406. {  CloseGraph; }
  1407.   CloseVesa;
  1408. end.
  1409. ***************************************************
  1410.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1411.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1412. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1413. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1414.     Color := RandColor;
  1415.     SetColor(Color);
  1416.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1417.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1418.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1419.   until KeyPressed;
  1420.   WaitToGo;
  1421. end; { RandBarPlay }
  1422.  
  1423. procedure ArcPlay;
  1424. { Draw random arcs on the screen }
  1425. var
  1426.   MaxRadius : word;
  1427.   EndAngle : word;
  1428.   ArcInfo : ArcCoordsType;
  1429. begin
  1430.   MainWindow('Arc / GetArcCoords demonstration');
  1431.   StatusLine('Esc aborts or press a key');
  1432.   MaxRadius := MaxY div 10;
  1433.   repeat
  1434.     SetColor(RandColor);
  1435.     EndAngle := Random(360);
  1436.     SetLineStyle(SolidLn, 0, NormWidth);
  1437.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1438.     GetArcCoords(ArcInfo);
  1439.     with ArcInfo do
  1440.     begin
  1441.       Line(X, Y, XStart, YStart);
  1442.       Line(X, Y, Xend, Yend);
  1443.     end;
  1444.   until KeyPressed;
  1445.   WaitToGo;
  1446. end; { ArcPlay }
  1447.  
  1448. procedure PutPixelPlay;
  1449. { Demonstrate the PutPixel and GetPixel commands }
  1450. const
  1451.   Seed   = 1962; { A seed for the random number generator }
  1452.   NumPts = 2000; { The number of pixels plotted }
  1453.   Esc    = #27;
  1454. var
  1455.   I : word;
  1456.   X, Y, Color : word;
  1457.   XMax, YMax  : integer;
  1458.   ViewInfo    : ViewPortType;
  1459. begin
  1460.   MainWindow('PutPixel / GetPixel demonstration');
  1461.   StatusLine('Esc aborts or press a key...');
  1462.  
  1463.   GetViewSettings(ViewInfo);
  1464.   with ViewInfo do
  1465.   begin
  1466.     XMax := (x2-x1-1);
  1467.     YMax := (y2-y1-1);
  1468.   end;
  1469.  
  1470.   while not KeyPressed do
  1471.   begin
  1472.     { Plot random pixels }
  1473.     RandSeed := Seed;
  1474.     I := 0;
  1475.     while (not KeyPressed) and (I < NumPts) do
  1476.     begin
  1477.       Inc(I);
  1478.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  1479.     end;
  1480.  
  1481.     { Erase pixels }
  1482.     RandSeed := Seed;
  1483.     I := 0;
  1484.     while (not KeyPressed) and (I < NumPts) do
  1485.     begin
  1486.       Inc(I);
  1487.       X := Random(XMax)+1;
  1488.       Y := Random(YMax)+1;
  1489.       Color := GetPixel(X, Y);
  1490.         if Color = RandColor then
  1491.           PutPixel(X, Y, 0);
  1492.      end;
  1493.   end;
  1494.   WaitToGo;
  1495. end; { PutPixelPlay }
  1496.  
  1497. procedure PutImagePlay;
  1498. { Demonstrate the GetImage and PutImage commands }
  1499.  
  1500. const
  1501.   r  = 20;
  1502.   StartX = 100;
  1503.   StartY = 50;
  1504.  
  1505. var
  1506.   CurPort : ViewPortType;
  1507.  
  1508. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  1509. var
  1510.   Step : integer;
  1511. begin
  1512.   Step := Random(2*r);
  1513.   if Odd(Step) then
  1514.     Step := -Step;
  1515.   X := X + Step;
  1516.   Step := Random(r);
  1517.   if Odd(Step) then
  1518.     Step := -Step;
  1519.   Y := Y + Step;
  1520.  
  1521.   { Make saucer bounce off viewport walls }
  1522.   with CurPort do
  1523.   begin
  1524.     if (x1 + X + Width - 1 > x2) then
  1525.       X := x2-x1 - Width + 1
  1526.     else
  1527.       if (X < 0) then
  1528.         X := 0;
  1529.     if (y1 + Y + Height - 1 > y2) then
  1530.       Y := y2-y1 - Height + 1
  1531.     else
  1532.       if (Y < 0) then
  1533.         Y := 0;
  1534.   end;
  1535. end; { MoveSaucer }
  1536.  
  1537. var
  1538.   Pausetime : word;
  1539.   Saucer    : pointer;
  1540.   X, Y      : integer;
  1541.   ulx, uly  : word;
  1542.   lrx, lry  : word;
  1543.   Size      : word;
  1544.   I         : word;
  1545. begin
  1546.   ClearDevice;
  1547.   FullPort;
  1548.  
  1549.   { PaintScreen }
  1550.   ClearDevice;
  1551.   MainWindow('GetImage / PutImage Demonstration');
  1552.   StatusLine('Esc aborts or press a key...');
  1553.   GetViewSettings(CurPort);
  1554.  
  1555.   { DrawSaucer }
  1556.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  1557.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  1558.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  1559.   Circle(StartX+10, StartY-12, 2);
  1560.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  1561.   Circle(StartX-10, StartY-12, 2);
  1562.   SetFillStyle(SolidFill, MaxColor);
  1563.   FloodFill(StartX+1, StartY+4, GetColor);
  1564.  
  1565.   { ReadSaucerImage }
  1566.   ulx := StartX-(r+1);
  1567.   uly := StartY-14;
  1568.   lrx := StartX+(r+1);
  1569.   lry := StartY+(r div 3)+3;
  1570.  
  1571.   Size := ImageSize(ulx, uly, lrx, lry);
  1572.   GetMem(Saucer, Size);
  1573.   GetImage(ulx, uly, lrx, lry, Saucer^);
  1574. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  1575.  
  1576.   { Plot some "stars" }
  1577.   for I := 1 to 1000 do
  1578.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  1579.   X := MaxX div 2;
  1580.   Y := MaxY div 2;
  1581.   PauseTime := 70;
  1582.  
  1583.   { Move the saucer around }
  1584.   repeat
  1585. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  1586.      Delay(PauseTime);
  1587. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  1588.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  1589.   until KeyPressed;
  1590.   FreeMem(Saucer, size);
  1591.   WaitToGo;
  1592. end; { PutImagePlay }
  1593.  
  1594. procedure PolyPlay;
  1595. { Draw random polygons with random fill styles on the screen }
  1596. const
  1597.   MaxPts = 5;
  1598. type
  1599.   PolygonType = array[1..MaxPts] of PointType;
  1600. var
  1601.   Poly : PolygonType;
  1602.   I, Color : word;
  1603. begin
  1604.   MainWindow('FillPoly demonstration');
  1605.   StatusLine('Esc aborts or press a key...');
  1606.   repeat
  1607.     Color := RandColor;
  1608.     SetFillStyle(Random(11)+1, Color);
  1609.     SetColor(Color);
  1610.     for I := 1 to MaxPts do
  1611.       with Poly[I] do
  1612.       begin
  1613.         X := Random(MaxX);
  1614.         Y := Random(MaxY);
  1615.       end;
  1616.     FillPoly(MaxPts, Poly);
  1617.   until KeyPressed;
  1618.   WaitToGo;
  1619. end; { PolyPlay }
  1620.  
  1621. procedure FillStylePlay;
  1622. { Display all of the predefined fill styles available }
  1623. var
  1624.   Style    : word;
  1625.   Width    : word;
  1626.   Height   : word;
  1627.   X, Y     : word;
  1628.   I, J     : word;
  1629.   ViewInfo : ViewPortType;
  1630.  
  1631. procedure DrawBox(X, Y : word);
  1632. begin
  1633.   SetFillStyle(Style, MaxColor);
  1634.   with ViewInfo do
  1635.     Bar(X, Y, X+Width, Y+Height);
  1636.   Rectangle(X, Y, X+Width, Y+Height);
  1637.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  1638.   Inc(Style);
  1639. end; { DrawBox }
  1640.  
  1641. begin
  1642.   MainWindow('Pre-defined fill styles');
  1643.   GetViewSettings(ViewInfo);
  1644.   with ViewInfo do
  1645.   begin
  1646.     Width := 2 * ((x2+1) div 13);
  1647.     Height := 2 * ((y2-10) div 10);
  1648.   end;
  1649.   X := Width div 2;
  1650.   Y := Height div 2;
  1651.   Style := 0;
  1652.   for J := 1 to 3 do
  1653.   begin
  1654.     for I := 1 to 4 do
  1655.     begin
  1656.       DrawBox(X, Y);
  1657.       Inc(X, (Width div 2) * 3);
  1658.     end;
  1659.     X := Width div 2;
  1660.     Inc(Y, (Height div 2) * 3);
  1661.   end;
  1662.   SetTextJustify(LeftText, TopText);
  1663.   WaitToGo;
  1664. end; { FillStylePlay }
  1665.  
  1666. procedure FillPatternPlay;
  1667. { Display some user defined fill patterns }
  1668. const
  1669.   Patterns : array[0..11] of FillPatternType = (
  1670.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  1671.             OldColor which has a path of pixels of OldColor or NewColor
  1672.             with sides touching back to the seed point, (XSeed, YSeed).
  1673.             Therefore, only pixels of OldColor are modified and no other
  1674.             information is changed.
  1675.  
  1676.             SEE ALSO
  1677.  
  1678.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLAREA,
  1679.             FILLCONVEXPOLY, FILLPAGE, FILLPOLY, FILLSCREEN, FILLVIEW,
  1680.             SETVIEW
  1681.  
  1682.             EXAMPL(HNxHHO$B<BBBB<$<BBBB<<BBBB<$BBBBBF:0BBBBF:$BBBF:B<""AAA""AAAAA"<B@@B<" <2\A">>xDDxDNDD <` <>BB= > <BBBB< BBBBF:2L\bBBBB&AaQIECA8$>""">0@@A>@@@ b$(. b$(*
  1683.     $    $    $DDDDDDD¬U¬U¬U¬U¬U¬U¬Uw▌w▌w▌w▌w▌w▌w▌°°°⌠ⁿ°°⌠⌠ⁿ⌠⌠ⁿⁿ°°°    ≈  ≈  ≈≈         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       7HH7"B\DBBRL~BB@@@@@@?R~!!~?DDDD8BBBB|@@Ç>P>III>"AA""AAA"Uw<DDDD86II6"EIQ"\ @@ "AAAAA> >     hH02L2L$$<H(,$<>>>>>>>         VMODE=VIDEOMODEGET
  1684.             IF WHICHVGA = 0 THEN STOP
  1685.             DUMMY=RES640
  1686.             SETVIEW 100, 100, 539, 379
  1687.             FILLVIEW 10
  1688.             WHILE INKEY$ = ""
  1689.             WEND
  1690.             VIDEOMODESET VMODE
  1691.             END
  1692.  
  1693.  
  1694.  
  1695.  
  1696.  
  1697.  
  1698.  
  1699.  
  1700.  
  1701.  
  1702.  
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.                                                                          63
  1709.  
  1710.  
  1711.  
  1712.  
  1713.  
  1714.           FONTGETINFO
  1715.  
  1716.             PROTOTYPE
  1717.  
  1718.             SUB FONTGETINFO (Width%, Height%)
  1719.  
  1720.             INPUT
  1721.  
  1722.             no input parameters
  1723.     WEND
  1724.             MOUSEEXIT
  1725.             VIDEOMODESET VMODE
  1726.             END
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758.  
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.                                                                          86
  1768.  
  1769.  
  1770.  
  1771.  
  1772.  
  1773.           MOUSECURSORDEFAULT
  1774.  
  1775.             PROTOTYPE
  1776.  
  1777.             SUB MOUSECURSORDEFAULT ()
  1778.  
  1779.             INPUT
  1780.  
  1781.             no input parameters
  1782.  
  1783.             OUTPUT
  1784.  
  1785.             no value returned
  1786.  
  1787.             USAGE
  1788.  
  1789.             MOUSECURSORDEFAULT defines the mouse cursor to be a small
  1790.        ,K$╖┼╘╤░XQ)σ┤ö≡÷┴─┤àñT┘,╘¬àñX9╘⌠àñ\9╘UÜ╢≤`9╘4a╘d9╘UTa╘h9╘ta╘l9╘Uöa╘p9╘┤a╘t┘PT±x┴îÇ╖0▓ïα│ÅαU┤ôα╡ùα╢¢α╖úΓ╘pǺΓ╕¡αë ╚┴πì°sKÉφb<$⌡▌ë     φë φë I1φë  Eφë $YφÆë (mφë ,üφë 0$òφë á⌐φë ñ╜φë I¿╤φë ¼σφë ░∙φÆë 4²ë ┤!²ë ╕$5²ë ╝I²ë └]²ë ⌐8q²ë <àⁿΦiǬ∙PÖÇ ¥Ç
  1791. ⁿ░╨â@%8@ΓΦá╝╤░≡cÑÅ*$░╕≡ż≡τ╥m¿⌡ε    ╨@#µ≈$âh$âαra╨à`¥è∩Ç%Ç +─▀ TîcOî∩â°1<@  [$¿Ç¼ MMl·0ƒ Y¼─!%6a▐è ¥ì ßá+?±  P<îaTTV ╪iÇ¡≥░ `_ñ»%Çá᪠P█º»ε`éa∙É%H«┴íA%Gár∙É
  1792. iw∙Éiφ`╧≥≡╤Çmⁿ▒
  1793. ]ÆAáσw7░⌡∩    $·╟Ç√É&^`  ┐ $ⁿ  $■ $╒ nk$J-ÉQ1£PéBù »0αQ/Ñ4╜£░ºP≈Ñ4Ç⌡$(ª▀$@C]Æé≈└╕_SÇçÑ4=iÉ⌠ä╣<_np@Ñ45ò▒Y3ü¼Qí░.i>╠@5+┴╙É╛╙$@ #┴@«╦
  1794. $╤
  1795. #@Ñú4,p&e÷ü¼_ÇQºÑ4òQ  ü@;¡_áQ@e╠≥@mp!┤a╘O░√`Pñź ÇT°8ÿ!¼Åñ$½╙"q¿ PñCÇ¿α√└╥░eT"ß<p°%Pæ(╧%pδ¥/OêW0Ǽbφ φ B@[â¼8â≥µ≤(    ¿⌡%(Ç∩áTÿp+ óÜ▓0!Σ±(1±░┤ÖÇD└D0Å╡`   $ «îO@╧1
  1796. a╝╤j-0ñ│`@╖bΦaT1═⌠╝╤Σ²¼±,1öíî9lÿ28ÇÅ`Γî¿P²$,N0┴O0a╫δ≤0σú`°î╖#0δ≡└X▄1»Σî(▒¥Ç█Ñ"qá√1CÇú╟╨º Å
  1797. FT Θ²î└1ÇY0    w ²à░$@AÅ`╦Φ¼╘`▄1A  }┐Ç*5 ΩSδδî`¼îaδæ¼î5 1¿⌡Ω╜⌠ ¼¥╬ü└Qî1S╛≤î9╨iÇ,∙PU(}Ç$üÇ àÇ`σìÇ`QαÜBO$%ÿÇ╧"$Ç«Ç]É.┬\`%WÉ$  W0 ÄâO0]αG┬ur╩░£▒Q¢ú╔Ç≡°s?`X0╘`@ µWâ@╣aá εdq`¥9?Ç&+o0µyÄΣAÅuV(7P╬±@IdQ╕@Å┤@;Ç▓?Çò│CÇ┤╟╨╡KÇÄ30ⁿφ° ó╬ì+]Ä╦≡     Mö╝σ ²y5<!└▀óâ╝É3~mp    $<╛≤9Æ-2ⁿ≡@T,╞Σa,)Pæ└¥#¼╪Q┤S(¼@Aîa≡╤@Ö²±⌠KëD─┴▒▀0╨Ñ$╩-0 ╨ê*╙▓edm`î=3Kß-10è=≥≤²└£mîjy ÿe²ⁿ╨i╕e▓ΣmαÖ╢C%Ç*ê*0 EátQZ`mÄLP%    °üⁿªüNQ∙  T¿<qtWΩc z░ÅÇñΩçǪçÇ«;└<┐á¼¥. á?<Σscî)áí := 0;
  1798.       end;
  1799.     end;
  1800.   end;
  1801.   WaitToGo;
  1802. end; { UserLineStylePlay }
  1803.  
  1804.  
  1805. procedure SayGoodbye;
  1806. { Say goodbye and then exit the program }
  1807. var
  1808.   ViewInfo : ViewPortType;
  1809. begin
  1810.   MainWindow('');
  1811.   GetViewSettings(ViewInfo);
  1812.   SetTextStyle(TriplexFont, HorizDir, 4);
  1813.   SetTextJustify(CenterText, CenterText);
  1814.   with ViewInfo do
  1815.     OutTextXY((x2-x1) div 2, (y2-y1) div 2, 'That''s all folks!');
  1816.   StatusLine('Press any key to quit...');
  1817.   repeat until KeyPressed;
  1818. end; { SayGoodbye }
  1819.  
  1820.  
  1821. PROCEDURE SelectMode;
  1822. VAR
  1823.     choice1,choice2     : CHAR;
  1824.    xsize,ysize            : WORD;
  1825. BEGIN
  1826.     (* Let's select a mode *)
  1827.     ClrScr;
  1828.     WriteLn('VESADEMO:');
  1829.     WriteLn('1. 256 colors');
  1830.     WriteLn('2. 32768 colors');
  1831.     WriteLn('3. 65536 colors');
  1832.     WriteLn('4. 16777216 colors');
  1833.     WriteLn('Q uit');
  1834.     WriteLn;
  1835.     Write('Your choice: ');
  1836.     REPEAT
  1837.         ReadLn(choice1);
  1838.       IF choice1 <> '1' THEN BEGIN
  1839.           WriteLn('Sorry !');
  1840.          WriteLn('This demo wasn''t written for more as 256 colors !');
  1841.          WriteLn('You would only get a limited impression of the Hi-& TrueColor modes...');
  1842.          WriteLn('Switching to 256 colors.');
  1843.          choice1 := '1';
  1844.       END;
  1845.     UNTIL choice1 IN ['1'..'4','q'];
  1846.     IF choice1 = 'q' THEN Halt;
  1847.  
  1848.     WriteLn;
  1849.     WriteLn;
  1850.     WriteLn('a. 320x200');
  1851.     WriteLn('b. 640x480');
  1852.     WriteLn('c. 800x600');
  1853.     WriteLn('d. 1024x768');
  1854.     WriteLn('e. 1280x1024');
  1855.     WriteLn('Q uit');
  1856.     WriteLn;
  1857.     Write('Your choice: ');
  1858.     REPEAT
  1859.         ReadLn(choice2);
  1860.     UNTIL choice2 IN ['a'..'e','q'];
  1861.     IF choice2 = 'q' THEN Halt;
  1862.  
  1863.     CASE choice2 OF
  1864.         'a' : BEGIN
  1865.             xsize := 320;
  1866.             ysize := 200;
  1867.         END;
  1868.         'b' : BEGIN
  1869.             xsize := 640;
  1870.             ysize := 480;
  1871.         END;
  1872.         'c' : BEGIN
  1873.             xsize := 800;
  1874.             ysize := 600;
  1875.         END;
  1876.         'd' : BEGIN
  1877.             xsize := 1024;
  1878.             ysize := 768;
  1879.         END;
  1880.         'e' : BEGIN
  1881.             xsize := 1280;
  1882.             ysize := 1024;
  1883.         END;
  1884.     END;
  1885.     CASE choice1 OF
  1886.         '1' : mode := FindVesaMode(xsize,ysize,8);
  1887.         '2' : mode := FindVesaMode(xsize,ysize,15);
  1888.         '3' : mode := FindVesaMode(xsize,ysize,16);
  1889.         '4' : mode := FindVesaMode(xsize,ysize,24);
  1890.     END;
  1891.     IF mode = 0 THEN BEGIN
  1892.         WriteLn('No such mode could be found !');
  1893.         WriteLn('Switching to to 320x200.');
  1894.         ReadKey;
  1895.         mode := V320x200x256;
  1896.     END;
  1897. END;
  1898.  
  1899. begin { program body }
  1900.   SelectMode;
  1901.   Initialize;
  1902.   ReportStatus;
  1903.  
  1904. {  AspectRatioPlay; }
  1905.   FillEllipsePlay;
  1906.   SectorPlay;
  1907.   WriteModePlay;
  1908.  
  1909.   ColorPlay;
  1910.   { PalettePlay only intended to work on these drivers: }
  1911.   if (GraphDriver = EGA) or
  1912.       (GraphDriver = EGA64) or
  1913.       (GraphDriver = VGA) then
  1914.      PalettePlay;
  1915.   PutPixelPlay;
  1916. {  PutImagePlay; }
  1917.   RandBarPlay;
  1918.   BarPlay;
  1919.   Bar3DPlay;
  1920.   ArcPlay;
  1921.   CirclePlay;
  1922.   PiePlay;
  1923.   LineToPlay;
  1924.   LineRelPlay;
  1925. {  LineStylePlay; }
  1926. {  UserLineStylePlay; }
  1927.   TextDump;
  1928.   TextPlay;
  1929.   CrtModePlay;
  1930.   FillStylePlay;
  1931.   FillPatternPlay;
  1932.   PolyPlay;
  1933.   SayGoodbye;
  1934. {  CloseGraph; }
  1935.   CloseVesa;
  1936. end.
  1937. ***************************************************
  1938.     '* SHOW D2ROTATE (ABOUT THE ORIGIN)
  1939.     '****************************************************************∞╥≤c≤*φè#^│v/╒:j═φ0t+l▓ô"¬"g└≡?%ªêΣ│H╫½╫╜├¿U'╒⌐⌡ ßV?╩¬ujOΦçEZ1∞▐! ▄B╛Σ8║æ]1GlNÜ┐q▌▓;ô$ΦzE<cª*bEô#ä╧ñÅ"∩─LrdaÖ ╠º╫a^¥£å╬1~)@ëÖMδ╫0═6DäFê¬Çv┼ß╨kæpτ╪É)}ª 1w3╤╧ü⌡¥╓h▓╣≈ïÅaÑ[TⁿHqªÉ╝DKÄ─Y-∞tT╤Θ╨º╟╪.*ÇI9lΦ≈{πτcσ$τπßoFr╪╨∩┼╞╟;O2■e²LÜ4^N|╪½ÅO?╔°FOz`╟╟╟'<>>π$πΘù6·Xgî╖│°oîδπGƒd╝▀░?■╪╔_9L ⌡ôⁿq'æO▀ƒn4╔▀╚▄┼3pτ.òO°·}÷╕ⁿ±'æO?ít│!√8ßÑ≤/┐╣p┼≥┘E╦Vox╕cΦé5╟╚º╙$?√$≥ΘZεsî≡åìΓpKù¢ïß X╥ 9╞≈\µk┤O¥_ 5Üö\≤éÄ┌╤A[╤ÿáï┼éNⁿÅu16    g,%hc╙╨cD╨Vï┘R¢öKñR;8εáΣ╢╪ós╤π╡á└èxgzPÄMú╫yαºÉ+σJ¢i+▓â3╥    ═Ñ╙î^ºG▓█πérφçs %#(╗⌠?┼%u8≡6+QÉ))ò)Afw≈╣╪)B&4░åLXV:δät@Å.;5Φf╢Ät┐ΣJ╫─U8úÇ╟éö£╕p╔┴⌠vg╨╬╥é÷╪╣┬ΓI.ç≡^v╤ZΦÇ& ╒┌6ñô6XßNè╡╬E₧Ñ
  1940. kIº╠▄A+╣╥éb²tæ-Y¡½αÑa═uuîÇ╢αêvhuª╡SÅ┤vèùú¥F;p<d⌐/F─d█éT%▓KΦû=q■öI┐ ┐╠6S$▒÷╚ENΩ¥Fû9╔┌R'╝ ╧φ└?g┬j▓0═/b╖₧─mûé╢┌»ÿÄë/·<éò■░╤╟╢├Xσ:╥P3Θ"╬Læsφ░┌öSö!╗¿*mN£WΣÇ£┤~#╗ææ≥RΩóh:à▌.æ≈╕▌v£äàd▒à╒├=░╖π║$howeg*╬    6ù▄ƒô╕φ░Ö╢qΘD>(w@úKεHÆ╛öúΣU
  1941. éÜR╔╤W▄èê 2M%ó.▓SNÖA1ùJE╢║l]▓¿>\%└Å4ßO▄£â⌐& ê/)8vSP▀▓ôⁿææ√ü√ÑÄa⌠â╚4S╓╟P- ?Σá╕▓Næ*q╡UΘ▓≈^ñ·I.rúR&$Y^╚%è≡B┌≈Ceat
  1942.     Color := RandColor;
  1943.     SetColor(Color);
  1944.     SetFillStyle(Random(CloseDotFill)+1, Color);
  1945.     Bar3D(Random(MaxWidth), Random(MaxHeight),
  1946.           Random(MaxWidth), Random(MaxHeight), 0, TopOff);
  1947.   until KeyPressed;
  1948.   WaitToGo;
  1949. end; { RandBarPlay }
  1950.  
  1951. procedure ArcPlay;
  1952. { Draw random arcs on the screen }
  1953. var
  1954.   MaxRadius : word;
  1955.   EndAngle : word;
  1956.   ArcInfo : ArcCoordsType;
  1957. begin
  1958.   MainWindow('Arc / GetArcCoords demonstration');
  1959.   StatusLine('Esc aborts or press a key');
  1960.   MaxRadius := MaxY div 10;
  1961.   repeat
  1962.     SetColor(RandColor);
  1963.     EndAngle := Random(360);
  1964.     SetLineStyle(SolidLn, 0, NormWidth);
  1965.     Arc(Random(MaxX), Random(MaxY), Random(EndAngle), EndAngle, Random(MaxRadius));
  1966.     GetArcCoords(ArcInfo);
  1967.     with ArcInfo do
  1968.     begin
  1969.       Line(X, Y, XStart, YStart);
  1970.       Line(X, Y, Xend, Yend);
  1971.     end;
  1972.   until KeyPressed;
  1973.   WaitToGo;
  1974. end; { ArcPlay }
  1975.  
  1976. procedure PutPixelPlay;
  1977. { Demonstrate the PutPixel and GetPixel commands }
  1978. const
  1979.   Seed   = 1962; { A seed for the random number generator }
  1980.   NumPts = 2000; { The number of pixels plotted }
  1981.   Esc    = #27;
  1982. var
  1983.   I : word;
  1984.   X, Y, Color : word;
  1985.   XMax, YMax  : integer;
  1986.   ViewInfo    : ViewPortType;
  1987. begin
  1988.   MainWindow('PutPixel / GetPixel demonstration');
  1989.   StatusLine('Esc aborts or press a key...');
  1990.  
  1991.   GetViewSettings(ViewInfo);
  1992.   with ViewInfo do
  1993.   begin
  1994.     XMax := (x2-x1-1);
  1995.     YMax := (y2-y1-1);
  1996.   end;
  1997.  
  1998.   while not KeyPressed do
  1999.   begin
  2000.     { Plot random pixels }
  2001.     RandSeed := Seed;
  2002.     I := 0;
  2003.     while (not KeyPressed) and (I < NumPts) do
  2004.     begin
  2005.       Inc(I);
  2006.         PutPixel(Random(XMax)+1, Random(YMax)+1, RandColor);
  2007.     end;
  2008.  
  2009.     { Erase pixels }
  2010.     RandSeed := Seed;
  2011.     I := 0;
  2012.     while (not KeyPressed) and (I < NumPts) do
  2013.     begin
  2014.       Inc(I);
  2015.       X := Random(XMax)+1;
  2016.       Y := Random(YMax)+1;
  2017.       Color := GetPixel(X, Y);
  2018.         if Color = RandColor then
  2019.           PutPixel(X, Y, 0);
  2020.      end;
  2021.   end;
  2022.   WaitToGo;
  2023. end; { PutPixelPlay }
  2024.  
  2025. procedure PutImagePlay;
  2026. { Demonstrate the GetImage and PutImage commands }
  2027.  
  2028. const
  2029.   r  = 20;
  2030.   StartX = 100;
  2031.   StartY = 50;
  2032.  
  2033. var
  2034.   CurPort : ViewPortType;
  2035.  
  2036. procedure MoveSaucer(var X, Y : integer; Width, Height : integer);
  2037. var
  2038.   Step : integer;
  2039. begin
  2040.   Step := Random(2*r);
  2041.   if Odd(Step) then
  2042.     Step := -Step;
  2043.   X := X + Step;
  2044.   Step := Random(r);
  2045.   if Odd(Step) then
  2046.     Step := -Step;
  2047.   Y := Y + Step;
  2048.  
  2049.   { Make saucer bounce off viewport walls }
  2050.   with CurPort do
  2051.   begin
  2052.     if (x1 + X + Width - 1 > x2) then
  2053.       X := x2-x1 - Width + 1
  2054.     else
  2055.       if (X < 0) then
  2056.         X := 0;
  2057.     if (y1 + Y + Height - 1 > y2) then
  2058.       Y := y2-y1 - Height + 1
  2059.     else
  2060.       if (Y < 0) then
  2061.         Y := 0;
  2062.   end;
  2063. end; { MoveSaucer }
  2064.  
  2065. var
  2066.   Pausetime : word;
  2067.   Saucer    : pointer;
  2068.   X, Y      : integer;
  2069.   ulx, uly  : word;
  2070.   lrx, lry  : word;
  2071.   Size      : word;
  2072.   I         : word;
  2073. begin
  2074.   ClearDevice;
  2075.   FullPort;
  2076.  
  2077.   { PaintScreen }
  2078.   ClearDevice;
  2079.   MainWindow('GetImage / PutImage Demonstration');
  2080.   StatusLine('Esc aborts or press a key...');
  2081.   GetViewSettings(CurPort);
  2082.  
  2083.   { DrawSaucer }
  2084.   Ellipse(StartX, StartY, 0, 360, r, (r div 3)+2);
  2085.   Ellipse(StartX, StartY-4, 190, 357, r, r div 3);
  2086.   Line(StartX+7, StartY-6, StartX+10, StartY-12);
  2087.   Circle(StartX+10, StartY-12, 2);
  2088.   Line(StartX-7, StartY-6, StartX-10, StartY-12);
  2089.   Circle(StartX-10, StartY-12, 2);
  2090.   SetFillStyle(SolidFill, MaxColor);
  2091.   FloodFill(StartX+1, StartY+4, GetColor);
  2092.  
  2093.   { ReadSaucerImage }
  2094.   ulx := StartX-(r+1);
  2095.   uly := StartY-14;
  2096.   lrx := StartX+(r+1);
  2097.   lry := StartY+(r div 3)+3;
  2098.  
  2099.   Size := ImageSize(ulx, uly, lrx, lry);
  2100.   GetMem(Saucer, Size);
  2101.   GetImage(ulx, uly, lrx, lry, Saucer^);
  2102. {  PutImage(ulx, uly, Saucer^, XORput);               { erase image }
  2103.  
  2104.   { Plot some "stars" }
  2105.   for I := 1 to 1000 do
  2106.      PutPixel(Random(MaxX), Random(MaxY), RandColor);
  2107.   X := MaxX div 2;
  2108.   Y := MaxY div 2;
  2109.   PauseTime := 70;
  2110.  
  2111.   { Move the saucer around }
  2112.   repeat
  2113. {     PutImage(X, Y, Saucer^, XORput);                 { draw image }
  2114.      Delay(PauseTime);
  2115. {     PutImage(X, Y, Saucer^, XORput);                 { erase image }
  2116.      MoveSaucer(X, Y, lrx - ulx + 1, lry - uly + 1);  { width/height }
  2117.   until KeyPressed;
  2118.   FreeMem(Saucer, size);
  2119.   WaitToGo;
  2120. end; { PutImagePlay }
  2121.  
  2122. procedure PolyPlay;
  2123. { Draw random polygons with random fill styles on the screen }
  2124. const
  2125.   MaxPts = 5;
  2126. type
  2127.   PolygonType = array[1..MaxPts] of PointType;
  2128. var
  2129.   Poly : PolygonType;
  2130.   I, Color : word;
  2131. begin
  2132.   MainWindow('FillPoly demonstration');
  2133.   StatusLine('Esc aborts or press a key...');
  2134.   repeat
  2135.     Color := RandColor;
  2136.     SetFillStyle(Random(11)+1, Color);
  2137.     SetColor(Color);
  2138.     for I := 1 to MaxPts do
  2139.       with Poly[I] do
  2140.       begin
  2141.         X := Random(MaxX);
  2142.         Y := Random(MaxY);
  2143.       end;
  2144.     FillPoly(MaxPts, Poly);
  2145.   until KeyPressed;
  2146.   WaitToGo;
  2147. end; { PolyPlay }
  2148.  
  2149. procedure FillStylePlay;
  2150. { Display all of the predefined fill styles available }
  2151. var
  2152.   Style    : word;
  2153.   Width    : word;
  2154.   Height   : word;
  2155.   X, Y     : word;
  2156.   I, J     : word;
  2157.   ViewInfo : ViewPortType;
  2158.  
  2159. procedure DrawBox(X, Y : word);
  2160. begin
  2161.   SetFillStyle(Style, MaxColor);
  2162.   with ViewInfo do
  2163.     Bar(X, Y, X+Width, Y+Height);
  2164.   Rectangle(X, Y, X+Width, Y+Height);
  2165.   OutTextXY(X+(Width div 2), Y+Height+4, Int2Str(Style));
  2166.   Inc(Style);
  2167. end; { DrawBox }
  2168.  
  2169. begin
  2170.   MainWindow('Pre-defined fill styles');
  2171.   GetViewSettings(ViewInfo);
  2172.   with ViewInfo do
  2173.   begin
  2174.     Width := 2 * ((x2+1) div 13);
  2175.     Height := 2 * ((y2-10) div 10);
  2176.   end;
  2177.   X := Width div 2;
  2178.   Y := Height div 2;
  2179.   Style := 0;
  2180.   for J := 1 to 3 do
  2181.   begin
  2182.     for I := 1 to 4 do
  2183.     begin
  2184.       DrawBox(X, Y);
  2185.       Inc(X, (Width div 2) * 3);
  2186.     end;
  2187.     X := Width div 2;
  2188.     Inc(Y, (Height div 2) * 3);
  2189.   end;
  2190.   SetTextJustify(LeftText, TopText);
  2191.   WaitToGo;
  2192. end; { FillStylePlay }
  2193.  
  2194. procedure FillPatternPlay;
  2195. { Display some user defined fill patterns }
  2196. const
  2197.   Patterns : array[0..11] of FillPatternType = (
  2198.   ($AA, $55, $AA, $55, $AA, $55, $AA, $55 üÖü üÖü  !BBäx!!!BBäx!BBäx"""DDêp""DDêp>"""BBääêp""!"BDäêêp>IÉÆ|      ° @≥î>00>><Dêx  !BBäx""DDêp&<"DDêê&22TTêêê$> $< @äêp>          ⁿBBBB<  @@Ç****DDDDDDDU¬U¬U¬U¬U¬U¬U¬▌w▌w▌w▌w▌w▌w▌w°°°≥■°°≥≥■≥≥■■°°°    ≤  ≤  ≤≤         °                     ≡≡≡≡≡≡≡≡≡≡≡≡≡≡       ;DDD;    $"Bdÿ>@@@>||>Ac]AAA1N"A""2,  `1NA"*III*<Bü üB<<BüüüB<A" \"QIE" < <BBBB  @@    ~ ?  @ÇB$$B ""A$$"AII6 üBr»$**IIII**ccregion.  The region is defined as any pixel of
  2199.             OldColor which has a path of pixels of OldColor or NewColor
  2200.             with sides touching back to the seed point, (XSeed, YSeed).
  2201.             Therefore, only pixels of OldColor are modified and no other
  2202.             information is changed.
  2203.  
  2204.             SEE ALSO
  2205.  
  2206.             DRWFILLBOX, DRWFILLCIRCLE, DRWFILLELLIPSE, FILLARE